module Euler

let xs = Seq.initInfinite( fun index -> index * (index + 1) / 2 )
let isTriangle n = (xs |> Seq.find ((<=) n) = n)

let words = System.IO.File.ReadAllText(@"words.txt").Split(',') |> Seq.map (fun s -> s.Trim([|'"'|]))
let values = words |> Seq.map (Seq.fold (fun x c -> (x + int(c) - int('A') + 1)) 0 )

printfn "%d" (values |> Seq.filter isTriangle |> Seq.length )
